package com.cs.contract.controller;

import com.cs.contract.service.CsFramePlanService;
import com.cs.contract.domain.CsFramePlan;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author：zrx
 * @Package：com.cs.controller
 * @Project：RuoYi-Cloud
 * @name：CsFramePlanController
 * @Date：2024/11/28 9:05
 * @Filename：CsFramePlanController
 */
@RestController
@RequestMapping("/framework")
public class CsFramePlanController extends BaseController {
    private final CsFramePlanService csFramePlanService;

    public CsFramePlanController(CsFramePlanService csFramePlanService) {
        this.csFramePlanService = csFramePlanService;
    }

    /**
     * 查询框架计划列表
     */
    @GetMapping("/list1")
    public TableDataInfo list(CsFramePlan csFramePlan) {
        startPage();
        List<CsFramePlan> list = csFramePlanService.listCsFramePlan(csFramePlan);
        return getDataTable(list);
    }

    @PutMapping("/updateOidByPlanId")
    public AjaxResult updateOidByPlanId(@RequestBody CsFramePlan csFramePlan) {
        System.out.println(csFramePlan);
        Integer result = csFramePlanService.updateOidByPlanId(csFramePlan);
        System.out.println(result);
        if (result > 0) {
            return AjaxResult.success("修改成功");
        }
        return AjaxResult.success("修改失败");
    }
}
